<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('修改替换料')"/>
    <th:block th:include="include :: select2-css"/>
    <th:block th:include="include :: bootstrap-select-css"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-MaterialReplace-edit">
        <input id="id" name="id" type="hidden" th:value="${materialReplace.id}"/>
        <input id="rawMaterialId" name="rawMaterialId" type="hidden" th:value="${materialReplace.rawMaterial.id}"/>
        <div class="form-group">
            <label class="col-sm-3 control-label">物料编码：</label>
            <div class="col-sm-8">
                <input class="form-control" id="code" name="code" type="text"
                       th:field="*{materialReplace.rawMaterial.code}" readonly>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">物料名称：</label>
            <div class="col-sm-8">
                <input class="form-control" id="name" name="name" type="text"
                       th:field="*{materialReplace.rawMaterial.name}" readonly>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label is-required">替换料类型：</label>
            <div class="col-sm-8">
                <select id="type" name="type" class="form-control"
                        th:with="type=${@dict.getType('material_replace_type')}">
                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                            th:value="${dict.dictValue}" th:checked="${materialReplace.type}"></option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">替换料状态：</label>
            <div class="col-sm-8">
                <select name="status" class="form-control"
                        th:with="type=${@dict.getType('sys_normal_disable')}">
                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                            th:value="${dict.dictValue}"  th:checked="${materialReplace.status}"></option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">替换料：</label>
            <div class="col-sm-8">
                <select id="newMaterialId" name="newMaterialId" class="form-control">
                    <option th:each="newMaterial:${materialList}" th:value="${newMaterial.id}"
                            th:text="${newMaterial.code}+'-'+${newMaterial.name}"  th:checked="${materialReplace.newMaterialId}"></option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">备注：</label>
            <div class="col-sm-8">
                <textarea class="form-control" id="remark" name="remark">[[*{remark}]]</textarea>
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: select2-js"/>
<th:block th:include="include :: bootstrap-select-js"/>
<script type="text/javascript">
    var prefix = ctx + "system/material";

    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/editMaterialReplaceSave", $('#form-MaterialReplace-edit').serialize());
        }
    }
</script>
</body>
</html>
